use std::path::Path;

use anyhow::Result;
use polars::prelude::*;

#[tokio::main]
async fn main() -> Result<()> {
    tracing_subscriber::fmt::init();

    let file_path = Path::new("E:\\code\\rust\\sql-powerful\\file\\user_info.csv");
    
    // 使用 polars 直接请求
    let df = CsvReader::from_path(file_path)?
        .infer_schema(Some(2))
        .finish()?;

    println!("xxx");

    let filter = df.filter(&df["age"].gt(30))?;

    println!("yyy");

    let show = filter.select((
        "name",
        "age",
        "sex"
    ));

    println!("zzz");

    match show {
        Ok(df) => println!("123{:?}", df),
        Err(_) => println!("error"),
    }

    // println!(
    //     "{:?}",
    //     show
    // );
    // println!("{:?}", filtered);
    print!("yyy");
    Ok(())
}